<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户更新</title>
<s:include value="/app_common/common.jsp"></s:include>
<s:include value="/app_common/uploadify.jsp"></s:include>
<%--是否是新增 --%>
<!-- 表单验证start -->
<script src="<s:property value='webctx'/>/libs/js/form/validationRule.js" type="text/javascript"></script>
<script src="<s:property value='webctx'/>/libs/js/form/validation.js" type="text/javascript"></script>
<!-- 表单验证end -->
</head>
<body>
	<div class="box2" panelWidth="900" panelTitle="研究报告<s:property value="yjbg.y_id==0?'新增':'修改'"/>">
		<form name="form2" id="form2" method="post" target="frmright">
		<s:if test="!(yjbg.y_code==null||yjbg.y_code=='')">
			<%--所属人编码 --%>
			<s:hidden name="yjbg.y_submit_ucode" id="y_submit_ucode"></s:hidden>
			<%--所属人名称 --%>
			<s:hidden name="yjbg.y_submit_uname" id="y_submit_uname"></s:hidden>
			<%--所属分部--%>
			<s:hidden name="yjbg.y_submit_dpcode" id="y_submit_dpcode"></s:hidden>
			<%--所属分部名称--%>
			<s:hidden name="yjbg.y_submit_dpname" id="y_submit_dpname"></s:hidden>
		</s:if>
		<s:else>
			<%--所属人编码 --%>
			<s:hidden name="yjbg.y_submit_ucode" id="y_submit_ucode" value="%{#session.u_code}"></s:hidden>
			<%--所属人名称 --%>
			<s:hidden name="yjbg.y_submit_uname" id="y_submit_uname" value="%{#session.u_name}"></s:hidden>
			<%--所属分部--%>
			<s:hidden name="yjbg.y_submit_dpcode" id="y_submit_dpcode" value="%{#session.userltdcode}"></s:hidden>
			<%--所属分部名称--%>
			<s:hidden name="yjbg.y_submit_dpname" id="y_submit_dpname" value="%{#session.userltdname}"></s:hidden>
		</s:else>
			<s:hidden name="yjbg.y_id" id="y_id"></s:hidden>
			<table class="tableStyle" style="line-height: 30px" formMode="transparent">
				<tr>
					<td>报告编号:</td>
					<td style="color: red;">
						<s:property value="yjbg.y_code==null||yjbg.y_code==''?'自动生成':yjbg.y_code"/>
					</td>
					<td>报告名称：</td>
					<td>
						<input type="text" name="yjbg.y_name" value="<s:property value="yjbg.y_name" />" class="validate[required]">
						<span class="star">*</span>
					</td>
					<td>报告类别：</td>
					<td>
						<select name="yjbg.y_type" selectedValue="<s:property value='yjbg.y_type'/>" prompt="请选择" data='<s:property value="map.sel_12"/>' class="validate[required]"></select>
						<span class="star">*</span>
					</td>
					<td>重要程度：</td>
					<td>
						<select name="yjbg.y_zychengdu" selectedValue="<s:property value='yjbg.y_zychengdu'/>" prompt="请选择" data='<s:property value="map.sel_13"/>' class="validate[required]"></select>
						<span class="star">*</span>
					</td>
				</tr>
				<tr>
					<td>关键词:</td>
					<td colspan="7">
						<textarea name="yjbg.y_guanjianci" style="width: 777px;height: 60px"><s:property value="yjbg.y_guanjianci"/></textarea>
					</td>
				</tr>
				<tr>
					<td>报告摘要:</td>
					<td colspan="7">
						<textarea name="yjbg.y_zhaiyao" style="width: 777px;height: 60px"><s:property value="yjbg.y_zhaiyao"/></textarea>
					</td>
				</tr>
				<tr>
					<td style="padding: 0 8px;">附件上传:</td>
					<td align="left" style="padding: 2px 6px;" colspan="7">
						<div style="color: red;">小提示：附件允许最大上传文件数为5个</div>
						<div id="full"></div>
						<div id="allShow"></div>
						<div id="show"></div>
						<input type="file" keepDefaultStyle="true" name="uploadify" id="strutsUploadFile" />
						<br />
					</td>
				</tr>
				<tr>
					<td>提交时间:<s:property value=""/></td>
					<td>
						<s:property value="%{yjbg.y_code==null||yjbg.y_code==''?'自动生成':yjbg.y_submit_date}"/>
					</td>
					<td>提交人编码:</td>
					<td>
						<s:property value="%{yjbg.y_code==null||yjbg.y_code==''?#session.u_code:yjbg.y_submit_ucode}"/>
					</td>
					<td>提交人名称:</td>
					<td>
						<s:property value="%{yjbg.y_code==null||yjbg.y_code==''?#session.u_name:yjbg.y_submit_uname}"/>
					</td>
					<td>所属分部:</td>
					<td>
						<s:property value="%{yjbg.y_code==null||yjbg.y_code==''?#session.userltdname:yjbg.y_submit_dpname}"/>
					</td>
				</tr>
				<tr>
					<td colspan="8">
					<input type="button" onclick="back()" value="返回" />&nbsp;&nbsp;
					<input type="button" id="btn1" onclick="checkSubmit()" value="提交" />
					</td>
				</tr>
			</table>
		</form>
	</div>
</body>
<script type="text/javascript">
var status = "<s:property value='yjbg.y_id' />";
var y_id = status;
function checkSubmit(){
	var actionUrl;
	var valid = $("#form2").validationEngine({returnIsValid: true});
	if(!valid){
		return false;
	}
	if(status=="0"){
		actionUrl = webctx+"/yjbg/yjbg_insertYjbgById.action";
		isback = true;
		back_url = webctx+"/yjbg/yjbg_queryYjbg.action";
	}else{
		actionUrl = webctx+"/yjbg/yjbg_updateYjbgById.action";
	}
	var actionData = $("#form2").serialize();
	//return false;
	showProgressBar();
	$.ajax({
		url:actionUrl,
		data:actionData,
		type : "post",
		cache : false,
		dataType : 'text',
		success : function(data) {
			if(data!=0){
				gl_conId = data;
				$('#strutsUploadFile').uploadifySettings('scriptData',{'conId':data,'fileFolder':'TB_YJBG'}); 
				$('#strutsUploadFile').uploadifyUpload();
				if(y_id==0){
					var it = setInterval(function(){
						if(isover||$('#strutsUploadFileQueue').children().length==0){
							clearInterval(it);
							closeProgress();
							alert('操作成功!');
							window.location = webctx+"/yjbg/yjbg_queryYjbg.action";
						}
					},1000);
				}else{
					closeProgress();
					alert("操作成功!");
					selectFiles(data,'TB_YJBG');
				}
			}else{
				alert('操作失败!');
			}
		}
	});
}
function back(){
	top.Dialog.confirm("确认返回？",function(){
		showProgressBar();
		window.location = webctx+"/yjbg/yjbg_queryYjbg.action";
	});
	
}
$(function(){
	if(status!=0)selectFiles(status,"TB_YJBG");
});
</script>
</html>